import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '_views/Index'
// 避免重复点击路由产生的错误，此错误不影响程序的运行
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index
  },
  {
    path: '/rightnav',
    name: 'rightnav',
    component: () => import('_views/RightNav')
  },
  {
    path: '/daoqi',
    name: 'name',
    component: () => import('_views/Daoqi')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
